clear
%cd ('W:\Projects\Hoffmann_Shcherbakova\Programs_RES')
state_group='all';
s=1; T=42;
Main_preparation

dc=dc';
dgsp=dgsp';

for t=1:T
b=NewOLS(dc(:,t),[ones(K,1),dgsp(:,t)]);
betaU(t,:)=b.b(2,1);
end
[AX,H1,H2] = plotyy(years(1,2:T+1),betaU(1:T,1),years(1,2:T+1),dy(1:T,1));

title('Degree of Uninsured Risk and Business Cycle')%Figure 1: 
set(get(AX(1),'Ylabel'),'String','Degree of Uninsured Risk ','Color','blue')
set(get(AX(2),'Ylabel'),'String','Real GDP Growth','Color','red')
ax1 = gca;
set(AX(2),'XColor','k','YColor','r')
%set(H2,'YColor','none')
set(H1,'LineStyle','-')
set(H2,'LineStyle','--')

set(H1,'LineWidth',1.5)
set(H2,'LineWidth',1.5)
set(H1,'Color','blue')
set(H2,'Color','red')
set(H1,'Marker','d')
set(H1,'MarkerFaceColor','blue')

hold on
[ind,i]=find(NBERTrough(s:T+1)>0);
z=[];
z=[-2,2];
for i=1:size(ind,1)
plot([years(1,ind(i,1)),years(1,ind(i,1))],z,'k-')
end